package com.springboot.chongwu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.chongwu.entity.Zhixunlist;
import com.springboot.chongwu.entity.view.JuanzengView;
import com.springboot.chongwu.entity.view.ZhixunlistView;
import com.springboot.chongwu.mapper.ZhixunlistMapper;
import com.springboot.chongwu.qpage.QPage;
import com.springboot.chongwu.satoken.StpUserUtil;
import com.springboot.chongwu.service.IZhixunlistService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.chongwu.util.ResultView;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 咨询记录表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-09-27
 */
@Service
public class ZhixunlistServiceImpl extends ServiceImpl<ZhixunlistMapper, Zhixunlist> implements IZhixunlistService {

    @Override
    public ResultView getPageList(QPage qPage, ZhixunlistView obj) {
        IPage iPage = new Page(qPage.getOffset(), qPage.getLimit());
        List<ZhixunlistView> mapList = this.baseMapper.getPageList(iPage,obj);
        return ResultView.ok(iPage.setRecords(mapList));
    }

    @Override
    public ResultView add(Zhixunlist obj) {
        obj.setYid(StpUserUtil.getLoginIdAsInt());
        obj.setCtime(new Date());
        obj.setUtime(new Date());
        this.save(obj);
        return ResultView.ok();
    }

    @Override
    public List<Zhixunlist> getSelect(ZhixunlistView obj) {
        return baseMapper.getSelect(obj);
    }


}
